package com.huatai.datacenter.service;

import com.alibaba.fastjson.JSONObject;
import com.huatai.common.api.R;
import com.huatai.datacenter.constant.Constants;
import com.huatai.datacenter.entity.ServerObjectEntity;
import com.huatai.datacenter.mapper.ServerObjectMapper;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * @author Lion
 * @date 2023/6/19  20:55
 */
@Service
public class ServerObjectService extends BaseService<ServerObjectMapper, ServerObjectEntity>{
    public R<List<JSONObject>> getServerObject() {
		List<ServerObjectEntity> list = this.list();
		List<JSONObject> result = new ArrayList<>();
		for (ServerObjectEntity serverObjectEntity : list) {
			JSONObject jsonObject = new JSONObject();
			jsonObject.put("serverObjectName",serverObjectEntity.getServerObjectName());
			jsonObject.put("linkman",serverObjectEntity.getLinkman());
			jsonObject.put("appKey",serverObjectEntity.getAppKey());
			result.add(jsonObject);
		}
		return R.data(result);
	}
}
